var orderDetailAction = {
    init: function() {
        console.log('orderDetail init');

        this.render();
        this.expandAll();
    },
    render: function() {
        var that = this,
            data = orderListAction.listData[that.query.orderNo];
        console.log(data);
        app.tplManager({
            tplEl: "#orderDetailTpl",
            renderEl: "#orderDetailRender",
            renderData: data
        });
    },
    expandAll: function() {
        $("#orderDetailEP").on('click', function() {
            var self = $(this),
                foldCards = $("#orderDetailRender").find(".fold-card");

            self.toggleClass('off');
            if (self.hasClass('off')) {
                self.text('全部展开');
                foldCards.addClass('off');
            } else {
                self.text('全部收起');
                foldCards.removeClass('off');
            }

        });
    }
};

F7.onPageInit('orderDetailView', function(page) {
    orderDetailAction.query = page.query;
    orderDetailAction.init(page.query);
});

module.exports = orderDetailAction;
